//
//  NewsViewController.m
//  HappyBug
//
//  Created by liulei on 2018/10/16.
//  Copyright © 2018年 www.hc.com.cn. All rights reserved.
//

#import "NewsViewController.h"

#import "CustomButtom.h"

#import "LoginViewController.h"
@interface NewsViewController ()

@end

@implementation NewsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //修改navigationController bar、 颜色
    self.navigationController.navigationBar.barTintColor=[UIColor whiteColor];
    UIImage *leftimage=[UIImage imageNamed:@"tabbar_icon_media_normal"];
    UIImage *lrightimage=[UIImage imageNamed:@"tabbar_icon_found_normal"];
    //--->也可以
    //    UIImage *newImage=[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    //
    //    UIBarButtonItem *leftItem=[[UIBarButtonItem alloc]initWithImage:newImage style:UIBarButtonItemStyleDone target:self action:@selector(leftClick)];
    
    
    UIButton *button =[[UIButton alloc]init];
    [button setBackgroundImage:leftimage forState:UIControlStateNormal];
    UIBarButtonItem *item =[[UIBarButtonItem alloc]initWithCustomView:button];
    
    UIButton *button2 =[[UIButton alloc]init];
    [button2 setBackgroundImage:lrightimage forState:UIControlStateNormal];
    UIBarButtonItem *item2 =[[UIBarButtonItem alloc]initWithCustomView:button2];
    
    self.navigationItem.leftBarButtonItem=item;
    self.navigationItem.rightBarButtonItem=item2;
    
    
    //右侧。。自定义button
    CustomButtom *custum_button=[[CustomButtom alloc]initWithFrame:CGRectMake(0, 0, 70, 30)];
    custum_button.layer.borderWidth=0.8;
    [custum_button setFont:[UIFont systemFontOfSize:12]];
    custum_button.layer.cornerRadius=5;
    [custum_button.layer setBackgroundColor:[UIColor whiteColor].CGColor];
    [custum_button setBackgroundColor:[UIColor whiteColor]];
    [custum_button setTitle:@"北京" forState:UIControlStateNormal];
    [custum_button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [custum_button addTarget:self action:@selector(selectCity) forControlEvents:UIControlEventTouchUpInside];
    [custum_button setImage:[UIImage imageNamed:@"tabbar_icon_found_normal"] forState:UIControlStateNormal];
    UIBarButtonItem *item3 =[[UIBarButtonItem alloc]initWithCustomView:custum_button];
    self.navigationItem.rightBarButtonItem=item3;
}
-(void)selectCity{
    LoginViewController *login=[[LoginViewController alloc]init];
    UINavigationController *navLoginView=  [[UINavigationController alloc]initWithRootViewController:login];
    [self presentViewController:navLoginView animated:YES completion:^{}];
    
    
}

@end
